DICT_WORDS = {'direction': ['north', 'south', 'east', 'west', 'down', 'up', 'left', 'right', 'back'],
    'verb': ['go','stop','kill','eat'],
    'stop': ['the', 'in', 'of', 'from', 'at', 'it'],
    'noun': ['door', 'bear', 'princess', 'cabinet']
}

def scan(words):
    result = []
    for word in words.split():
        result.append(scan_single_word(word))
    return result
    
def scan_single_word(word):
    word_lower = word.lower()
    word_keys = DICT_WORDS.keys()
    
    for key in word_keys:
        if word_lower in DICT_WORDS[key]:
            return (key, word)
    try:
        return ('number', int(word))
    except ValueError:
        return ('error', word)
